package com.atguigu.mybatis.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component("hero1")
@Data
public class Hero {


    private int id;
    private String nickName;

    @Autowired
    @Qualifier(value = "sword1")
    private Sword sword;
    //定义行侠仗义的方法
    public void doGoodThings(){
        System.out.println("doGoodThings...");
    }

    //定义舞林争霸的方法
    public void tryToNo1(){
        System.out.println("tryToNo1...");
        sword.doHit();
    }
}
